<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: jetson-utils/timespec.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('timespec_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">timespec.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="timespec_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * copy of this software and associated documentation files (the &quot;Software&quot;),</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * to deal in the Software without restriction, including without limitation</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Software is furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> * The above copyright notice and this permission notice shall be included in</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * all copies or substantial portions of the Software.</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * DEALINGS IN THE SOFTWARE.</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#ifndef __TIMESPEC_UTIL_H__</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#define __TIMESPEC_UTIL_H__</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;time.h&gt;</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">   36</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">timestamp</a>( timespec* timestampOut )         { <span class="keywordflow">if</span>(!timestampOut) <span class="keywordflow">return</span>; timestampOut-&gt;tv_sec=0; timestampOut-&gt;tv_nsec=0; clock_gettime(CLOCK_REALTIME, timestampOut); } </div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="group__time.html#ga43627a5af271e9abfd46b467d2e309a8">   43</a></span>&#160;<span class="keyword">inline</span> timespec <a class="code" href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">timestamp</a>()                                                     { timespec t; <a class="code" href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">timestamp</a>(&amp;t); <span class="keywordflow">return</span> t; }</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="group__time.html#gaf3c8f1da6d7ab35e2aba66796bff9b7d">   50</a></span>&#160;<span class="keyword">inline</span> timespec <a class="code" href="group__time.html#gaf3c8f1da6d7ab35e2aba66796bff9b7d">timeZero</a>()                                                      { timespec t; t.tv_sec=0; t.tv_nsec=0; <span class="keywordflow">return</span> t; }</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">   57</a></span>&#160;<span class="keyword">inline</span> timespec <a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>( time_t seconds, <span class="keywordtype">long</span> <span class="keywordtype">int</span> nanoseconds )         { timespec t; t.tv_sec=seconds; t.tv_nsec=nanoseconds; <span class="keywordflow">return</span> t; }</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="group__time.html#ga99ec3a2bb4cf3de4f7e9a9ccc600255e">   64</a></span>&#160;<span class="keyword">inline</span> timespec <a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>( <span class="keywordtype">long</span> <span class="keywordtype">int</span> nanoseconds )                                         { <span class="keyword">const</span> time_t sec=nanoseconds/1e-9; <span class="keywordflow">return</span> <a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>(sec, nanoseconds-sec*1e-9); }</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="group__time.html#gaf087d50741339d18a1c4101985b30a8a">   71</a></span>&#160;<span class="keyword">inline</span> timespec <a class="code" href="group__time.html#gaf087d50741339d18a1c4101985b30a8a">timeAdd</a>( <span class="keyword">const</span> timespec&amp; a, <span class="keyword">const</span> timespec&amp; b )         { timespec t; t.tv_sec=a.tv_sec+b.tv_sec; t.tv_nsec=a.tv_nsec+b.tv_nsec; <span class="keyword">const</span> time_t sec=t.tv_nsec/1e-9; t.tv_sec+=sec; t.tv_nsec-=sec*1e-9; <span class="keywordflow">return</span> t; }</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="group__time.html#ga3c4b729b99d06b423956e7a3a17aaeb4">   78</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#ga3c4b729b99d06b423956e7a3a17aaeb4">timeDiff</a>( <span class="keyword">const</span> timespec&amp; start, <span class="keyword">const</span> timespec&amp; end, timespec* result )</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;{</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keywordflow">if</span> ((end.tv_nsec-start.tv_nsec)&lt;0) {</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                result-&gt;tv_sec = end.tv_sec-start.tv_sec-1;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                result-&gt;tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;                result-&gt;tv_sec = end.tv_sec-start.tv_sec;</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                result-&gt;tv_nsec = end.tv_nsec-start.tv_nsec;</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        }</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;}</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="group__time.html#gaa07ea1ff9097095950d78066456cd703">   94</a></span>&#160;<span class="keyword">inline</span> timespec <a class="code" href="group__time.html#ga3c4b729b99d06b423956e7a3a17aaeb4">timeDiff</a>( <span class="keyword">const</span> timespec&amp; start, <span class="keyword">const</span> timespec&amp; end )</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;{</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        timespec result;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        <a class="code" href="group__time.html#ga3c4b729b99d06b423956e7a3a17aaeb4">timeDiff</a>(start, end, &amp;result);</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordflow">return</span> result;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;}</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="group__time.html#ga86c3f22b9c909bb11014c38634c29778">  111</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__time.html#ga86c3f22b9c909bb11014c38634c29778">timeCmp</a>( <span class="keyword">const</span> timespec&amp; a, <span class="keyword">const</span> timespec&amp; b )</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;{</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;        <span class="keywordflow">if</span>( a.tv_sec &lt; b.tv_sec )</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>( a.tv_sec &gt; b.tv_sec )</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;                <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        {</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                <span class="keywordflow">if</span>( a.tv_nsec &lt; b.tv_nsec )</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;                <span class="keywordflow">else</span> <span class="keywordflow">if</span>( a.tv_nsec &gt; b.tv_nsec )</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;                        <span class="keywordflow">return</span> 1;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;                <span class="keywordflow">else</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                        <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        }</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;}</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="group__time.html#ga762b4a9f55b4fb1a50d459cc7c384b92">  132</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="group__time.html#ga762b4a9f55b4fb1a50d459cc7c384b92">timeFloat</a>( <span class="keyword">const</span> timespec&amp; a )                                                             { <span class="keywordflow">return</span> a.tv_sec * 1000.0f + a.tv_nsec * 0.000001f; }</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div><div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="group__time.html#gafbe65af09ebc9e440699fe41a587206b">  139</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="group__time.html#gafbe65af09ebc9e440699fe41a587206b">timeDouble</a>( <span class="keyword">const</span> timespec&amp; a )                                                            { <span class="keywordflow">return</span> a.tv_sec * 1000.0 + a.tv_nsec * 0.000001; }</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="group__time.html#gab04eb4210d4a3f76a0502234c783c61e">  146</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">char</span>* <a class="code" href="group__time.html#gab04eb4210d4a3f76a0502234c783c61e">timeStr</a>( <span class="keyword">const</span> timespec&amp; <a class="code" href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">timestamp</a>, <span class="keywordtype">char</span>* strOut )                         { sprintf(strOut, <span class="stringliteral">&quot;%lu s  %lu ns&quot;</span>, (uint64_t)timestamp.tv_sec, (uint64_t)timestamp.tv_nsec); <span class="keywordflow">return</span> strOut; }</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno"><a class="line" href="group__time.html#ga10a0bd8b7e29af965bb1fa4de9153a52">  153</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#ga10a0bd8b7e29af965bb1fa4de9153a52">timePrint</a>( <span class="keyword">const</span> timespec&amp; <a class="code" href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">timestamp</a>, <span class="keyword">const</span> <span class="keywordtype">char</span>* text=NULL )               { printf(<span class="stringliteral">&quot;%s   %lus  %010luns\n&quot;</span>, text, (uint64_t)timestamp.tv_sec, (uint64_t)timestamp.tv_nsec); }</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno"><a class="line" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">  160</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a>( <span class="keyword">const</span> timespec&amp; duration )                                                       { nanosleep(&amp;duration, NULL); }</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;</div><div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="group__time.html#ga43f8222b603f11d862375e2bc1923b0d">  167</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a>( time_t seconds, <span class="keywordtype">long</span> <span class="keywordtype">int</span> nanoseconds )                           { <a class="code" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a>(<a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>(seconds,nanoseconds)); } </div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="group__time.html#gadc10da23418dffce632d3bd16000bc5a">  174</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#gadc10da23418dffce632d3bd16000bc5a">sleepMs</a>( uint64_t milliseconds )                                                            { <a class="code" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a>(<a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>(0, milliseconds * 1000 * 1000)); }</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;</div><div class="line"><a name="l00181"></a><span class="lineno"><a class="line" href="group__time.html#ga5b8575ba34c76a27111d26ebac8d347a">  181</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#ga5b8575ba34c76a27111d26ebac8d347a">sleepUs</a>( uint64_t microseconds )                                                            { <a class="code" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a>(<a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>(0, microseconds * 1000)); }</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div><div class="line"><a name="l00188"></a><span class="lineno"><a class="line" href="group__time.html#gade2df9f88a694448445740eca02343b9">  188</a></span>&#160;<span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__time.html#gade2df9f88a694448445740eca02343b9">sleepNs</a>( uint64_t nanoseconds )                                                                     { <a class="code" href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a>(<a class="code" href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a>(0, nanoseconds)); }</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="group__time_html_ga762b4a9f55b4fb1a50d459cc7c384b92"><div class="ttname"><a href="group__time.html#ga762b4a9f55b4fb1a50d459cc7c384b92">timeFloat</a></div><div class="ttdeci">float timeFloat(const timespec &amp;a)</div><div class="ttdoc">Convert to 32-bit float (in milliseconds). </div><div class="ttdef"><b>Definition:</b> timespec.h:132</div></div>
<div class="ttc" id="group__time_html_ga5b8575ba34c76a27111d26ebac8d347a"><div class="ttname"><a href="group__time.html#ga5b8575ba34c76a27111d26ebac8d347a">sleepUs</a></div><div class="ttdeci">void sleepUs(uint64_t microseconds)</div><div class="ttdoc">Put the current thread to sleep for a specified number of microseconds. </div><div class="ttdef"><b>Definition:</b> timespec.h:181</div></div>
<div class="ttc" id="group__time_html_gafbe65af09ebc9e440699fe41a587206b"><div class="ttname"><a href="group__time.html#gafbe65af09ebc9e440699fe41a587206b">timeDouble</a></div><div class="ttdeci">float timeDouble(const timespec &amp;a)</div><div class="ttdoc">Convert to 64-bit double (in milliseconds). </div><div class="ttdef"><b>Definition:</b> timespec.h:139</div></div>
<div class="ttc" id="group__time_html_ga10a0bd8b7e29af965bb1fa4de9153a52"><div class="ttname"><a href="group__time.html#ga10a0bd8b7e29af965bb1fa4de9153a52">timePrint</a></div><div class="ttdeci">void timePrint(const timespec &amp;timestamp, const char *text=NULL)</div><div class="ttdoc">Print the time to stdout. </div><div class="ttdef"><b>Definition:</b> timespec.h:153</div></div>
<div class="ttc" id="group__time_html_ga741cdb5863f122d3e527c8b53e0cb3c3"><div class="ttname"><a href="group__time.html#ga741cdb5863f122d3e527c8b53e0cb3c3">timestamp</a></div><div class="ttdeci">void timestamp(timespec *timestampOut)</div><div class="ttdoc">Retrieve a timestamp of the current system time. </div><div class="ttdef"><b>Definition:</b> timespec.h:36</div></div>
<div class="ttc" id="group__time_html_gadc10da23418dffce632d3bd16000bc5a"><div class="ttname"><a href="group__time.html#gadc10da23418dffce632d3bd16000bc5a">sleepMs</a></div><div class="ttdeci">void sleepMs(uint64_t milliseconds)</div><div class="ttdoc">Put the current thread to sleep for a specified number of milliseconds. </div><div class="ttdef"><b>Definition:</b> timespec.h:174</div></div>
<div class="ttc" id="group__time_html_ga3c4b729b99d06b423956e7a3a17aaeb4"><div class="ttname"><a href="group__time.html#ga3c4b729b99d06b423956e7a3a17aaeb4">timeDiff</a></div><div class="ttdeci">void timeDiff(const timespec &amp;start, const timespec &amp;end, timespec *result)</div><div class="ttdoc">Find the difference between two timestamps. </div><div class="ttdef"><b>Definition:</b> timespec.h:78</div></div>
<div class="ttc" id="group__time_html_gade2df9f88a694448445740eca02343b9"><div class="ttname"><a href="group__time.html#gade2df9f88a694448445740eca02343b9">sleepNs</a></div><div class="ttdeci">void sleepNs(uint64_t nanoseconds)</div><div class="ttdoc">Put the current thread to sleep for a specified number of nanoseconds. </div><div class="ttdef"><b>Definition:</b> timespec.h:188</div></div>
<div class="ttc" id="group__time_html_gaf087d50741339d18a1c4101985b30a8a"><div class="ttname"><a href="group__time.html#gaf087d50741339d18a1c4101985b30a8a">timeAdd</a></div><div class="ttdeci">timespec timeAdd(const timespec &amp;a, const timespec &amp;b)</div><div class="ttdoc">Add two times together. </div><div class="ttdef"><b>Definition:</b> timespec.h:71</div></div>
<div class="ttc" id="group__time_html_gaccb3fcd271afec70d82b9914834a3936"><div class="ttname"><a href="group__time.html#gaccb3fcd271afec70d82b9914834a3936">timeNew</a></div><div class="ttdeci">timespec timeNew(time_t seconds, long int nanoseconds)</div><div class="ttdoc">Return an initialized timespec </div><div class="ttdef"><b>Definition:</b> timespec.h:57</div></div>
<div class="ttc" id="group__time_html_ga54b6c83056c1f1324bcbc2dab776b273"><div class="ttname"><a href="group__time.html#ga54b6c83056c1f1324bcbc2dab776b273">sleepTime</a></div><div class="ttdeci">void sleepTime(const timespec &amp;duration)</div><div class="ttdoc">Put the current thread to sleep for a specified time. </div><div class="ttdef"><b>Definition:</b> timespec.h:160</div></div>
<div class="ttc" id="group__time_html_ga86c3f22b9c909bb11014c38634c29778"><div class="ttname"><a href="group__time.html#ga86c3f22b9c909bb11014c38634c29778">timeCmp</a></div><div class="ttdeci">int timeCmp(const timespec &amp;a, const timespec &amp;b)</div><div class="ttdoc">Compare two timestamps. </div><div class="ttdef"><b>Definition:</b> timespec.h:111</div></div>
<div class="ttc" id="group__time_html_gaf3c8f1da6d7ab35e2aba66796bff9b7d"><div class="ttname"><a href="group__time.html#gaf3c8f1da6d7ab35e2aba66796bff9b7d">timeZero</a></div><div class="ttdeci">timespec timeZero()</div><div class="ttdoc">Return a blank timespec that&amp;#39;s been zero&amp;#39;d. </div><div class="ttdef"><b>Definition:</b> timespec.h:50</div></div>
<div class="ttc" id="group__time_html_gab04eb4210d4a3f76a0502234c783c61e"><div class="ttname"><a href="group__time.html#gab04eb4210d4a3f76a0502234c783c61e">timeStr</a></div><div class="ttdeci">char * timeStr(const timespec &amp;timestamp, char *strOut)</div><div class="ttdoc">Produce a text representation of the timestamp. </div><div class="ttdef"><b>Definition:</b> timespec.h:146</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_54a0acf6da04fe2ed9410b4c6369bc5d.html">jetson-utils</a></li><li class="navelem"><a class="el" href="timespec_8h.html">timespec.h</a></li>
    <li class="footer">Generated on Thu Sep 26 2019 12:19:11 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
